** -------------------- Table 7: Investment volume controlling for firms' demand
use "$data_path/database_bdc_company_level_synthetic.dta", clear

reghdfe fair_value_ln i.ind_post##i.ind_treated_bdc lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker filingdateqtr company_time_fe) vce(cluster company_all_num)
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estadd local controls "Yes"
estadd local company_time_fe "Yes"
estadd local company_instr_time_fe "No"
estadd local county_time_fe "No"
estadd local county_instr_time_fe "No"
estadd local industry_time_fe "No"
estadd local industry_instr_time_fe "No"
estimates store reg_a1

reghdfe fair_value_ln2 i.ind_post##i.ind_treated_bdc lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker filingdateqtr company_time_fe)  vce(cluster company_all_num)
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estadd local controls "Yes"
estadd local company_time_fe "Yes"
estadd local company_instr_time_fe "No"
estadd local county_time_fe "No"
estadd local county_instr_time_fe "No"
estadd local industry_time_fe "No"
estadd local industry_instr_time_fe "No"
estimates store reg_a2

reghdfe fair_value_ln2 i.ind_post##i.ind_treated_bdc lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets if exist_pairs_pre_post == 3, absorb(bdc_ticker filingdateqtr company_time_fe) vce(cluster company_all_num)
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estadd local controls "Yes"
estadd local company_time_fe "Yes"
estadd local company_instr_time_fe "No"
estadd local county_time_fe "No"
estadd local county_instr_time_fe "No"
estadd local industry_time_fe "No"
estadd local industry_instr_time_fe "No"
estimates store reg_a3

esttab reg_a1 reg_a2 reg_a3  ///
using "${tables_path}/table7a.tex" ///
,cells(b(star  fmt(2)) se(par  fmt(2))) stat(controls bdc_fe time_fe company_time_fe company_instr_time_fe county_instr_time_fe industry_instr_time_fe  r2 N, fmt(%~15s %~15s %~15s  %~15s %~15s  %~15s   %~15s %9.2g %~15s) layout(\mc{@} \mc{@} \mc{@} \mc{@}  \mc{@} \mc{@} \mc{@} @ \mc{@}) labels("Controls" "BDC FE" "Time FE" "Firm-Time FE" "Firm-Instrument-Time FE" "County-Instrument-Time FE" "Industry-Instrument-Time FE" "\$R^{2}\$" "\textit{N}")  ) ///
style(tex) starlevels(^{*} 0.10  ^{**} 0.05 ^{***} 0.01)  mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)") mgroups("All", pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  nonumbers collabels(none) alignment(D{.}{.}{-1}) ///
coeflabels(_cons "Constant" 1.ind_post "Post" 1.ind_treated_bdc "Treated" ind_in_russell2500 "Treated" 1.ind_post#1.ind_treated_bdc "Post \$\times\$ Treated" lag_debt_pct "Debt/Assets\$_{t-1}\$" lag_assets_total_ln "ln(Assets\$_{t-1}\$)" lag_int_inc_net_avg_assets "Net Int. Inc./Assets\$_{t-1}\$" lag_debt_pct_dm "Debt/Assets\$_{t-1}\$" lag_assets_total_ln_dm "ln(Assets\$_{t-1}\$)" lag_int_inc_net_avg_assets_dm "Net Int. Inc./Assets\$_{t-1}\$") ///
order(1.ind_post#1.ind_treated_bdc) replace substitute(\_ _) drop(_cons lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets) nobaselevels noomit ///
nolines prefoot(\midrule) postfoot(\bottomrule \end{tabular} }) posthead(\midrule)
 
